﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;

namespace common
{
    public class mapDirs
    {
        string path;
        string vpath;

        public mapDirs(string path, string vpath)
        {
            this.path = path;
            this.vpath = vpath;
        }

        public List<dirinfo> getDirs()
        {
            DirectoryInfo dir = new DirectoryInfo(path);
            FileSystemInfo[] fs = dir.GetFileSystemInfos();
            List<dirinfo> ld = new List<dirinfo>();
            foreach (FileSystemInfo p in fs)
            {
                dirinfo di = new dirinfo();
                di.path = vpath;
                di.name = p.Name;
                di.isdir = false;
                if (p is DirectoryInfo)
                {
                    di.isdir = true;
                }
                ld.Add(di);
            }
            return ld;
        }
    }

    public class dirinfo
    {
        public string name { get; set; }
        public Boolean isdir { get; set; }
        public string path { get; set; }
    }
}